package com.chzu.controller;

import com.chzu.pojo.ReadScore;
import com.chzu.pojo.vo.ScoreChartDateVo;
import com.chzu.result.JsonResult;
import com.chzu.service.ReadScoreService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;


/**
 * @Author lz
 * @Version 1.0
 * @Company 滁州大健康与养老产业研究院
 * @ClassName ReadScoreController
 * @Description 阅读推文所得积分的控制层
 * @Date 2022/02/10 22:17
 */
@RestController
@RequestMapping("/readScore")
@Api(tags = "阅读推文的积分")
public class ReadScoreController {

    @Resource
    private ReadScoreService readScoreService;

    @ApiOperation("获取用户阅读推文所得的积分")
    @GetMapping("/")
    public JsonResult<ReadScore> getReadScore() {
        ReadScore data = readScoreService.getReadScore();
        return JsonResult.ok(data);
    }

    @ApiOperation("获取各个阅读推文积分段人数")
    @GetMapping("/getNum")
    public JsonResult<List<ScoreChartDateVo>> getStudentNumByScore() {
        List<ScoreChartDateVo> data = readScoreService.getStudentNumByScore();
        return JsonResult.ok(data);
    }
}
